CC = g++
SOURCES = $(wildcard *.cpp)  
OBJS = $(patsubst %.cpp,%.o, $(SOURCES))  
DEPS = $(patsubst %.cpp,%.d, $(SOURCES))  
CBUILD_PATH = ./build/ 
TARGET = mainasdasdasdasdzxcqwasd.d

ifdef PBUILD_PATH
CBUILD_PATH = $(PBUILD_PATH)
endif


define cmd_finsh


if [ ! -d $(CBUILD_PATH) ]; then \
    mkdir -p $(CBUILD_PATH); \
fi

	cp *.o $(CBUILD_PATH)
endef


$(TARGET):$(OBJS) $(DEPS)
	$(cmd_finsh)
	@echo 目标完成!
	touch $@

%.d: %.h
	touch $@
	$(CC) -c $(patsubst %.h,%.cpp, $<) $(CFLAGS)
	
%.o:%.cpp
	$(CC) -c $< $(CFLAGS)
	
#%.d: %.cpp
#	$(CC) -M $< > $@ $(CFLAGS)

#sinclude $(DEPS)  

cleanall:clean
	@echo 清除所有!
	rm -rf ./build/

clean:
	@echo 清除生成文件！
	rm -f *.o *.d

share:clean
	@echo public/event/生成 share
	$(CC) -c -fPIC $(SOURCES) $(CFLAGS)
	mv *.o ../
	